export function getCoordinateString ([jd, wd]) {
  if (jd && wd) {
    return (jd >= 0 ? 'Ⓔ ' : 'Ⓦ ') + formatCoordinate(jd) + ' ' + (wd >= 0 ? 'Ⓝ ' : 'Ⓢ ') + formatCoordinate(wd)
  } else {
    return ''
  }
}

function formatCoordinate (val) {
  let value = parseFloat(val)
  const degrees = Math.floor(value)
  value = (value - degrees) * 60
  const minutes = Math.floor(value)
  value = (value - minutes) * 60
  return degrees + '°' + minutes + '\'' + value.toFixed(2) + '"'
}
